import { AxiosRequestConfig } from "axios"
import service from "./api"
// import { showToast, Dialog } from 'vant'
// import store from '@/store'

interface BaseResponse<T> {
    code: number
    status: boolean
    data: T
    msg?: string
    body: T
    header: T
    success: boolean
    token?:string
}

const request = <T>(config: AxiosRequestConfig): Promise<BaseResponse<T>> => {
    return new Promise((resolve, _reject) => {
        service.request<BaseResponse<T>>(config).then(
            (res) => {
                resolve(res.data)
            },
            () => {}
        )
    })
}

export default request
